class Solution
{
public:
    int largestPalindrome(int n)
    {
        return vector<int>{9, 987, 123, 597, 677, 1218, 877, 475}[n - 1];
    }
};